<?php

class SJB_ImportFile
{
	var $file_info 	= null;
	var $data		= null;

	function SJB_ImportFile($file_info)
	{
		$this->file_info = $file_info;
	}

	function getData()
	{
		return $this->data;
	}

	public static function isValidFileExtensionByFormat($fileType, $file)
	{
		$pathInfo = (isset($file['name'])) ? pathinfo($file['name']) : pathinfo($file);
		$fileExtension = isset($pathInfo['extension']) ? strtolower($pathInfo['extension']) : '';
		$fileType = strtolower($fileType);
		switch ($fileExtension) {
			case 'csv':
				return in_array($fileType, array('csv'));
			case 'xls':
			case 'xlsx':
				return in_array($fileType, array('excel', 'xls', 'xlsx'));
		}
		return false;
	}
}
